<?php
namespace app\modules\system\actions;

use app\lib\ActionBase;
use app\service\data as data;
use app\lib\Code;

class Setting extends ActionBase {
    
    private $_setting;
    
    public $bannerlist;
    
    public function __construct() {
        $this->_setting = new data\Setting();
    }
    
    public function rules() {
        return [
            //获取任务信息
            ['bannerlist','required','on'=>'setBanner', 'message'=>'banner不能为空'],
        ];
    }
    
    public function GetBannerList($arrInput) {
        return $this->_setting->GetBannerList($arrInput);
    }
    
    //保存banner
    public function SetBannerList($arrInput) {
        $arrInput['isshow'] = $arrInput['isshow'] ?? false;
        $this->setScenario("setBanner");
        $this->load($arrInput, '');
        if (!$this->validate()) {
            formatJson(Code::PARAM, $this->parseErrors2str($this->firstErrors));
        }
        
        return $this->_setting->SetBannerList($arrInput);
        
    }
}